<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>4.cors解决跨域_简单请求</title>
</head>

<body>
    <button onclick="getStudents()">获取学生列表</button>
    <script type="text/javascript">
        async function getStudents() {
            // const url = "http://127.0.0.1:8081/students";
            const url = "http://localhost:8081/students";
            const response = await fetch(url, { method: 'POST' });
            let data = await response.json()
            console.log(data);
        }
    </script>
</body>

</html>